import openpyxl

from config.config import *


def read_excel(file_path=EXCEL_FILE, sheet_name=SHEET_NAME):   # 传  文件地址 和 表

    workbook = openpyxl.load_workbook(file_path)
    worksheet = workbook[sheet_name]
    data = []
    keys = [cell.value for cell in worksheet[2]]
    for row in worksheet.iter_rows(min_row=3, values_only=True):
        dict_data = dict(zip(keys, row))
        # 判断该用例是否需要执行
        if dict_data["is_true"]:
            data.append(dict_data)

    # print(data)

    workbook.close()
    return data





